# -*- coding: utf-8 -*-
# @project: huawang-api20230914
# @file： tmp_lzx_003.py
# @Time：2023/8/3 17:53
# @Author：lizhixiong
from common.log.log import log


def match_string234234(str1, str2):
    """
    比对字符串
    两者完全匹配返回True反之False
    """
    try:
        # 找到较短的字符串长度
        min_length = min(len(str1), len(str2))
        # 使用循环比较字符，并构建不一致的字符串列表
        diff_list = []
        for i in range(min_length):
            if str1[i] != str2[i]:
                diff_list.append(str1[i])
        if len(diff_list) == 0:
            return True
        else:
            log.error(f"比对出现错误为：{''.join(diff_list)}")
            return False
    except Exception as e:
        log.error(f'异常为：{e}')


# 测试
string1 = '{"code":200,"message":"操作成功","data":{"id":20354,"orderId":"order166798003807326038","realName":"黎","userPhone":"18665825382","userAddress":"上海市上海市黄浦区测试地址","freightPrice":"0.00","totalPrice":"0.01","proTotalPrice":"0.01","payPrice":"0.01","payPostage":"0.00","deductionPrice":"0.00","couponId":0,"couponPrice":"0.00","paid":true,"payTime":"2022-11-09 15:47:24","payType":"weixin","createTime":"2022-11-09 15:47:18","status":3,"refundStatus":0,"refundReasonWapImg":null,"refundReasonWapExplain":null,"refundReasonTime":null,"refundReasonWap":null,"refundReason":null,"refundPrice":"0.00","refundLogisticsNo":null,"refundCompany":null,"refundChannel":0,"deliveryName":"京东物流","deliveryType":"express","deliveryId":"JD0083197304996","useIntegral":0,"mark":"","isInvoice":2,"invoiceStatus":"已驳回","reason":"测试","balancePayPrice":"0.00","weChatPayPrice":"0.00","isDel":false,"isMerCheck":0,"combinationId":0,"pinkId":0,"seckillId":0,"bargainId":0,"verifyCode":"","storeId":0,"shippingType":1,"isChannel":1,"type":0,"payTypeStr":"微信支付","orderStatusMsg":"交易完成,感谢您的支持","systemStore":null,"mapKey":"SM-XWFX7","statusPic":"https://hwyg.jinhua-global.com/jinhua/upload/image/maintain/2022/10/19/4c9b9ae45e4c40b2a2832ac7e7a79d4e9ptluy5dns.gif","orderInfoList":[{"attrId":558,"productId":75,"cartNum":1,"image":"https://hwyg.jinhua-global.com/jinhua/upload/image/maintain/2022/10/18/64c3d553a8b8452db774cede65704411on1mcmngch.png","storeName":"测试数据-花王赋长青酒+花王赋长盛酒赠精美酒具2盒","price":"0.01","isReply":0,"sku":"一箱(6瓶x500ml)+2瓶","vipPrice":"0.01","giveIntegral":null,"storeIntegral":null,"storeGive":null,"storeRebate":null,"id":44045,"deliveryInformation":null,"statusStr":null,"quantityShipped":null,"quantityOfGoodsToBeShipped":null,"isGift":null,"sort":2,"integralPrice":null}],"province":"上海市","city":"上海市","area":"黄浦区","detail":"测试地址","isDefaultAddress":false,"vipDeductionPrice":"0.00","isSplit":false,"userAddressId":0,"isCanBuy":true,"isCanBuyNum":null}}'
string2 = '{"code":200,"message":"操作成功","data":{"id":20354,"orderId":"order166798003807326038","realName":"黎","userPhone":"18665825382","userAddress":"上海市上海市黄浦区测试地址","freightPrice":"0.00","totalPrice":"0.01","proTotalPrice":"0.01","payPrice":"0.01","payPostage":"0.00","deductionPrice":"0.00","couponId":0,"couponPrice":"0.00","paid":true,"payTime":"2022-11-09 15:47:24","payType":"weixin","createTime":"2022-11-09 15:47:18","status":3,"refundStatus":0,"refundReasonWapImg":null,"refundReasonWapExplain":null,"refundReasonTime":null,"refundReasonWap":null,"refundReason":null,"refundPrice":"0.00","refundLogisticsNo":null,"refundCompany":null,"refundChannel":0,"deliveryName":"京东物流","deliveryType":"express","deliveryId":"JD0083197304996","useIntegral":0,"mark":"","isInvoice":2,"invoiceStatus":"已驳回","reason":"测试","balancePayPrice":"0.00","weChatPayPrice":"0.00","isDel":false,"isMerCheck":0,"combinationId":0,"pinkId":0,"seckillId":0,"bargainId":0,"verifyCode":"","storeId":0,"shippingType":1,"isChannel":1,"type":0,"payTypeStr":"微信支付","orderStatusMsg":"交易完成,感谢您的支持","systemStore":null,"mapKey":"SM-XWFX7","statusPic":"https://hwyg.jinhua-global.com/jinhua/upload/image/maintain/2022/10/19/4c9b9ae45e4c40b2a2832ac7e7a79d4e9ptluy5dns.gif","orderInfoList":[{"attrId":558,"productId":75,"cartNum":1,"image":"https://hwyg.jinhua-global.com/jinhua/upload/image/maintain/2022/10/18/64c3d553a8b8452db774cede65704411on1mcmngch.png","storeName":"测试数据-花王赋长青酒+花王赋长盛酒赠精美酒具2盒","price":"0.01","isReply":0,"sku":"一箱(6瓶x500ml)+2瓶","vipPrice":"0.01","giveIntegral":null,"storeIntegral":null,"storeGive":null,"storeRebate":null,"id":44045,"deliveryInformation":null,"statusStr":null,"quantityShipped":null,"quantityOfGoodsToBeShipped":null,"isGift":null,"sort":2}],"province":"上海市","city":"上海市","area":"黄浦区","detail":"测试地址","isDefaultAddress":false,"vipDeductionPrice":"0.00","isSplit":false,"userAddressId":0,"isCanBuy":true,"isCanBuyNum":null}}'

assert match_string234234(string1, string2)
